/**
 * @date 2006-5-12 15:32:59
 *
 */
package org.nanhill.commons.pattern.domain;

import java.io.Serializable;
import java.util.List;

/**
 * Doamin Manager, used for Dao
 * 
 * @author alin [xalinx at gmail dot com]
 * 
 */
public interface EntityManager<E, ID extends Serializable> {
	public List<E> findPart(int start, int size);

	/**
	 * Return all persistent instances of the wildcard entity class.
	 * 
	 * @return
	 */
	public List<E> findAll();

	/**
	 * Return the persistent instance of the wildcard entity class with the
	 * given identifier, or <code>null</code> if not found.
	 * 
	 * @param id
	 * @return
	 */
	public E findById(ID id);

	/**
	 * Return the count of all persistent instance.
	 * 
	 * @return
	 */
	public int findCount();

	/**
	 * Persist the given persistent instance.
	 * 
	 * @param entity
	 */
	public void save(E entity);

	/**
	 * Delete the given persistent instance.
	 * 
	 * @param entity
	 */
	public void delete(E entity);

	/**
	 * Merge the given persistent instance.
	 * 
	 * @param entity
	 */
	public void merge(E entity);

}
